# f = open(r'd:\test.txt', 'w')
# f.write('软件1801在上课')
# f.close()

# with open(r'd:test.txt', 'a') as f:
#     f.write('，一世长安一世欢')

# 数据维度的问题
# 一维数组：


import json

fr = open('tse.csv', 'r')
ls = []
for line in fr:
    line = line.replace('\n', '')
    ls.append(line.split(','))
fr.close()
fw = open('tse.json', 'w')
for i in range(1, len(ls)):
    ls[i] = dict(zip(ls[0], ls[i]))
json.dump(ls[1:], fw, sort_keys=True, indent=4)
fw.close()




# dt = {'c': 2, 'b': 3, 'a': 5}
# f = json.dumps(dt)
# print(type(dt))
# print(type(f))
# f1 = json.loads(f)
# print(f1)
# print(f)
